package br.com.abenildo.visao;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JSeparator;

public class JFrameLoguin extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JPasswordField passwordField;
	JFrameMenu jframemenu = new JFrameMenu();
	JFrameCadastrarNoSistema cadastrarNoSistema = new JFrameCadastrarNoSistema();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JFrameLoguin frame = new JFrameLoguin();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JFrameLoguin() {
		setTitle("GRUPO FACABEMFEITO");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(102, 153, 153));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNome = new JLabel("Nome");
		lblNome.setBounds(82, 47, 46, 14);
		contentPane.add(lblNome);
		
		textField = new JTextField();
		textField.setBounds(151, 44, 93, 20);
		contentPane.add(textField);
		textField.setColumns(10);
		
		JLabel lblSenhacpf = new JLabel("Senha/CPF");
		lblSenhacpf.setBounds(66, 93, 70, 14);
		contentPane.add(lblSenhacpf);
		
		passwordField = new JPasswordField();
		passwordField.setBounds(151, 90, 93, 20);
		contentPane.add(passwordField);
		
		JButton btnNoSouCadastrado = new JButton("Cadastrar");
		btnNoSouCadastrado.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(cadastrarNoSistema != null){
					cadastrarNoSistema.setVisible(true);
				}
				fecharTelaAtual();
			}
		});
		btnNoSouCadastrado.setBackground(new Color(51, 204, 153));
		btnNoSouCadastrado.setBounds(173, 215, 106, 23);
		contentPane.add(btnNoSouCadastrado);
		
		JButton btnConfirma = new JButton("Confirma");
		btnConfirma.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(jframemenu != null){
					jframemenu.setVisible(true);
				}
				//Chamando o metodo
				fecharTelaAtual();
			}
		});
		btnConfirma.setBackground(new Color(204, 204, 255));
		btnConfirma.setBounds(156, 133, 89, 23);
		contentPane.add(btnConfirma);
		
		JLabel lblParaSeCadastrar = new JLabel("Para se cadastrar no sistema  clique  aqui!");
		lblParaSeCadastrar.setBounds(82, 185, 276, 19);
		contentPane.add(lblParaSeCadastrar);
		
		JSeparator separator = new JSeparator();
		separator.setBackground(new Color(205, 92, 92));
		separator.setBounds(50, 170, 339, 10);
		contentPane.add(separator);
	}
	 public void fecharTelaAtual(){
		 this.dispose();
	 }

}
